﻿@model OKRs.Models.ObjectiveViewModels.AllObjectivesListViewModel

@{
    ViewData["Title"] = "All Objectives";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<ol class="breadcrumb">
    <li><a asp-controller="Home" asp-action="Index">Home</a></li>
</ol>
<h3 class="clearfix">
    <span class="pull-left">@ViewData["Title"]</span>

    <a class="btn btn-sm btn-primary pull-right" asp-action="CreateForUser">
        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
        New Objective
    </a>
    
</h3>

@foreach (var userObjectives in Model.UserObjectivesList)
{
    <div class="list-group">
        <div href="#" class="list-group-item active clearfix">
            <a  class="list-group-item-heading pull-left" asp-controller="Objective" asp-action="ByUserId" asp-route-userId="@userObjectives.User.Id"><strong>@userObjectives.User.Name</strong></a>
            <a class="btn btn-xs btn-primary pull-right" asp-controller="Objective" asp-action="CreateForUser" asp-route-id="@userObjectives.User.Id">
                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                Add Objective for User
            </a>
        </div>
        @foreach (var objective in userObjectives.Objectives)
        {
            <a asp-controller="Objective" asp-action="Details" asp-route-id="@objective.Id" class="list-group-item">
                O: @objective.Title
                <span class="badge" title="@objective.KeyResults.Count() Key Result(s)">@objective.KeyResults.Count()</span>
            </a>
        }
    </div>
}
